/**
 * Created by showtan on 2018/12/27.
 * Global
 */

import React, { Component, PureComponent } from 'react';
import PropTypes from 'prop-types';
import {
  StyleSheet,
  Text,
  View,
  TouchableOpacity,
  Image,
  ImageBackground,
  Platform,
  DeviceEventEmitter,
  TouchableWithoutFeedback,
  FlatList,
  ScrollView,
  Dimensions,
  Animated,
  SectionList,
  Easing,
  Vibration,
  Picker,
  Switch,
  Alert,
  TouchableHighlight,
  WebView,
  InteractionManager,
  Linking,
  TextInput,
  ActivityIndicator,
  StatusBar,
  BackHandler,
  AppState,
  ToastAndroid,
  NativeModules,
  CameraRoll,
  PermissionsAndroid,
  Modal,
  ActionSheetIOS,
  Keyboard,
  KeyboardAvoidingView,

} from 'react-native';
import { connect } from 'dva';
import { createStackNavigator, createAppContainer } from 'react-navigation';
import { createMaterialBottomTabNavigator } from 'react-navigation-material-bottom-tabs';
import { createBottomTabNavigator, BottomTabBar } from 'react-navigation-tabs';
import { Toast, Theme } from 'teaset';
import YXStorage from 'react-native-realm-sync-storage';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
import Geolocation from 'Geolocation';
// import BackgroundJob from 'react-native-background-job'; //后台任务 杀死APP任务cancel(三星手机任务还存在) 暂不支持ios
import BackgroundTimer from 'react-native-background-timer'; //后台任务 支持ios
import DeviceInfo from 'react-native-device-info';
import { SwipeListView } from 'react-native-swipe-list-view';
import Spinner from 'react-native-spinkit';

import { adapt, isIphoneX, regular } from '../utils';
import CommonUtils from '../utils/CommonUtils';
import { AndroidRefreshControlComponent, AnimationCell, CheckButton, Loading, RefreshControlComponent, TextCell } from '../components';
import Images from './Images';

global.isIOS = (Platform.OS == 'ios');
global.width = Dimensions.get('window').width;
global.height = Dimensions.get('window').height;
global.themeColor = '#e40203';
global.isMoreThan7 = (Platform.OS == 'ios') && DeviceInfo.getDeviceId().split(',')[0].split('iPhone')[1] >= 7;

global.React = React;
global.Component = Component;
global.PureComponent = PureComponent;
global.PropTypes = PropTypes;
global.StyleSheet = StyleSheet;
global.Text = Text;
global.View = View;
global.TouchableOpacity = TouchableOpacity;
global.Image = Image;
global.ImageBackground = ImageBackground;
global.Platform = Platform;
global.DeviceEventEmitter = DeviceEventEmitter;
global.TouchableWithoutFeedback = TouchableWithoutFeedback;
global.FlatList = FlatList;
global.ScrollView = ScrollView;
global.Animated = Animated;
global.SectionList = SectionList;
global.Easing = Easing;
global.Vibration = Vibration;
global.Picker = Picker;
global.Switch = Switch;
global.Alert = Alert;
global.TouchableHighlight = TouchableHighlight;
global.WebView = WebView;
global.InteractionManager = InteractionManager;
global.Linking = Linking;
global.TextInput = TextInput;
global.ActivityIndicator = ActivityIndicator;
global.StatusBar = StatusBar;
global.BackHandler = BackHandler;
global.AppState = AppState;
global.ToastAndroid = ToastAndroid;
global.NativeModules = NativeModules;
global.CameraRoll = CameraRoll;
global.PermissionsAndroid = PermissionsAndroid;
global.Modal = Modal;
global.ActionSheetIOS = ActionSheetIOS;
global.Keyboard = Keyboard;
global.KeyboardAvoidingView = KeyboardAvoidingView;
global.connect = connect;
global.createStackNavigator = createStackNavigator;
global.createBottomTabNavigator = createBottomTabNavigator;
global.BottomTabBar = BottomTabBar;
global.createAppContainer = createAppContainer;
global.createMaterialBottomTabNavigator = createMaterialBottomTabNavigator;
global.Toast = Toast;
global.Theme = Theme;
global.YXStorage = YXStorage;

global.adapt = adapt;
global.CommonUtils = CommonUtils;
global.isIphoneX = isIphoneX;
global.Regular = regular;
global.RefreshControlComponent = isIOS ? RefreshControlComponent : AndroidRefreshControlComponent;
global.AnimationCell = AnimationCell;
global.CheckButton = CheckButton;
global.Loading = Loading;
global.TextCell = TextCell;
global.Images = Images;
global.KeyboardAwareScrollView = KeyboardAwareScrollView;
global.Geolocation = Geolocation;
// global.BackgroundJob = BackgroundJob;
global.BackgroundTimer = BackgroundTimer;
global.DeviceInfo = DeviceInfo;
global.SwipeListView = SwipeListView;
global.Spinner = Spinner;